package practice;

public class Account2 {
    private static int counter=0;//类变量（静态字段）
    //赋值到哪一个标识编号
    private String name;
    private String no;
    private long balance;
    private int id;

    public Account2(String name,String no,long balance) {
        this.name = name;
        this.no = no;
        this.balance = balance;
        id = ++counter;//使用构造函数来设置他们的值
    }
    public  String getName(){
        return name;
    }
    public  String getNo(){
        return no;
    }

    public long getBalance() {
        return balance;
    }

    public int getId() {
        //获取标识编号
        return id;
    }
     public void deposit(long k){
            balance+=k;//存款
     }
     public void withdraw(long k){
        balance-=k;//取款
    }
}
